package com.zengqingfa.rabbitmq.pubsub;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.zengqingfa.rabbitmq.utils.RabbitConstant;
import com.zengqingfa.rabbitmq.utils.RabbitUtils;

/**
 * @author zengqingfa
 * 发布者
 */
public class WeatherBureau {


    public static void main(String[] args) throws Exception {
        Connection connection = RabbitUtils.getConnection();
        Channel channel = connection.createChannel();

        for (int i = 0; i < 10; i++) {
            //第一个参数交换机名字   其他参数和之前的一样
            channel.basicPublish(RabbitConstant.EXCHANGE_WEATHER, "", null, Integer.valueOf(i).toString().getBytes());
        }
        channel.close();
        connection.close();
    }
}
